package com.siberhus.tdfl.processor;

import com.siberhus.tdfl.CancelException;
import com.siberhus.tdfl.FieldDataException;
import com.siberhus.tdfl.mapping.LineMapper;

public interface DataFileProcessor<T> extends LineMapper<T>{
	
	public void beforeLoading();
	
	public void afterLoading();
	
	public void onStart() throws Exception;
	
	public void onFinish() throws Exception;
	
	public void validateItem(T item, FieldDataException fde) throws Exception ;
	
	public void processItem(T item) throws Exception ;
	
	public void update();
	/**
	 * Do after mapLine,validateItem or processItem in DataFileProcessor
	 * raise an exception. re-throw this exception to stop the job. 
	 * @param item
	 * @param exception
	 */
	public void onItemError(T item, Exception exception);
	
	public void onItemSuccess(T item);
	
	public void onCancel(CancelException e);
	
	public void onInterrupt(InterruptedException e);
	
	
}
